export default {
    data() {
        return {
            student_id: 0,
            info: '',
            src:''
        }
    },

    //进入页面加载
    mounted: function () {
        var that = this;
        //在缓存中获取值
        that.user_name = sessionStorage.getItem("user_name");
        that.user_id = sessionStorage.getItem("user_id");
        that.token = sessionStorage.getItem("access-token");
        if ((!that.token) || (!that.user_id) || (!that.user_name)) {
            that.$router.push('/login');
        }

        if (that.$route.query.student_id) {
            that.student_id = that.$route.query.student_id;
            that.detail();
        }
    },

    //方法
    methods: {

        /**
         * 提交审核
         * @param formName
         */
        sendAudit() {
            var that = this;
            //请求的数据
            var formData = {};
            formData.token = that.token;
            formData.user_identity_id = that.student_id;

            //请求邀请者列表
            that.$http.post(that.adminApi.api_url + "/User_Video/submit_user_info", formData, {
                emulateJSON: true
            }).then(
                function (res) {
                    that.$router.push({path: '/seller/student_audit',query:{student_id:that.student_id}});
                },
                function () {
                    // 处理失败的结果
                    that.$message({
                        type: 'error',
                        message: `操作提示: ${ '处理异常' }`
                    });
                });
        },

        //轮播详情
        detail: function () {
            var that = this;
            //请求的数据
            var formData = {};
            formData.token = that.token;
            formData.id = that.student_id;

            //请求邀请者列表
            that.$http.post(that.adminApi.api_url + "/User_Identity/show_code", formData, {
                emulateJSON: true
            }).then(
                function (res) {
                    that.info = res.body;
                    that.src = that.adminApi.api_url +"/User_Video/download_video_code?code_url="+res.body.code_url
                },
                function () {
                    // 处理失败的结果
                    that.$message({
                        type: 'error',
                        message: `操作提示: ${ '处理异常' }`
                    });
                });
        },

        /**
         * 返回
         */
        cancel: function () {
            var that = this;
            that.$router.push({path: '/seller/student'});
        },

        /**
         * 刷新
         */
        refreshStatus:function () {
            var that = this;
            that.detail();
        }
    }
}